package br.com.rapidrest.demo.request;

import java.util.List;

import javax.servlet.FilterChain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import br.com.rapidrest.chain.Chain;
import br.com.rapidrest.chain.IgnoreCommand;
import br.com.rapidrest.demo.EJBFieldHandler;
import br.com.rapidrest.ioc.FieldHandler;
import br.com.rapidrest.request.BasicRequesHandler;

public class DemoRequestHandler extends BasicRequesHandler {

	private static final long serialVersionUID = -2906252428347952821L;

	@Override
	public Chain createChain(HttpServletRequest request,
			HttpServletResponse response, FilterChain filterChain) {
		Chain chain = super.createChain(request, response, filterChain);
		chain.getCommands().add(0, new IgnoreCommand("/css", "/js"));
		return chain;
	}

	@Override
	protected List<FieldHandler> getFieldHandlers() {
		List<FieldHandler> fieldHandlers = super.getFieldHandlers();
		fieldHandlers.add(new EJBFieldHandler());
		return fieldHandlers;
	}

	@Override
	protected String getWebPackage(HttpServletRequest request) {
		return "br.com.rapidrest.demo.web";
	}

}
